home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Add-Ons / BBEdit / MacBob 1.0ß2 / Source / MacBob.r < prev    next >
Encoding:
Text File  |  1995-12-10  |  8.3 KB  |  306 lines  |  [TEXT/KAHL]

  1. /***
  2.   *
  3.   *    MacBob.r - Resource file for MacBob
  4.   *    Copyright © 1995 by Christopher E. Hyde.  All rights reserved.
  5.   *
  6.   ***/
  7.  
  8. #include <Types.r>
  9. #include <SysTypes.r>
  10.  
  11. #define    versString        "1.0ß2"
  12. #define    versNumbers        1, 0, beta, 2
  13. #define    rBase            1000
  14. #define    rHelp            rBase+1000
  15. #define    emptyRect        {0, 0, 0, 0}
  16.  
  17.  
  18. #undef    reserved
  19. #define    reserved    = 0
  20. type 'BBXF' {            // BBEdit extension flags
  21.     integer = 0;
  22.     boolean        reserved;
  23.     boolean        reserved;
  24.     boolean        reserved;
  25.     boolean        reserved;
  26.     boolean        reserved;
  27.  
  28.     boolean        requiresPowerPC;
  29.     boolean        undoSavvy;
  30.     boolean        cantUndoAlert;
  31.     boolean        supportsNewInterface;
  32.     boolean        requiresNonEmptyWindow;
  33.  
  34.     boolean        reserved;        // Unused & Reserved (startup)
  35.  
  36.     boolean        requiresChangeableWindow;
  37.     boolean        useOptionkeyForDefaults;
  38.     boolean        canBeUndone;
  39.     boolean        requiresSelection;
  40.     boolean        requiresEditWindow;
  41. };
  42.  
  43. #define    cmdKey        0x01
  44. #define    shiftKey        0x02
  45. #define    optionKey        0x08
  46. #define    controlKey    0x10
  47.  
  48. type 'DKey' {            // Dialog key equivelents
  49.     wide array {
  50.         char;                        // fKey: Character code of keyboard key
  51.         byte;                        // fItem: Number of dialog item to click
  52.         byte anyDown = 0;            // fModsOn: Modifier keys that must be on (down)
  53.         byte anyUp = 0;                // fModsOff: Modifier keys that must be off (up)
  54. //        byte;                        // fPart: The item part to click
  55.     };
  56.     char = "\0x00";
  57. };
  58.  
  59. resource 'BBXF' (20, "MacBob") {
  60.     false,        // requiresPowerPC
  61.     true,        // undoSavvy
  62.     false,        // cantUndoAlert
  63.     false,        // supportsNewInterface
  64.     true,        // requiresNonEmptyWindow
  65.  
  66.     false,        // requiresChangeableWindow
  67.     false,        // useOptionkeyForDefaults
  68.     false,        // canBeUndone
  69.     false,        // requiresSelection
  70.     true        // requiresEditWindow
  71. };
  72.  
  73.  
  74. resource 'DLOG' (rBase, "Options", purgeable) {
  75.     {60, 70, 288, 411},
  76.     dBoxProc, visible, noGoAway,
  77.     0, rBase, ""
  78. };
  79.  
  80. #define    top            35
  81. #define    left            30
  82. #define    right            205
  83. #define    CBRect(n)        {top+(n*20), left, top+18+(n*20), right}
  84. #define    Option(n, l)    CBRect(n), Checkbox { enabled, l }
  85. #define    ButtonW(x,y,n)    {y, x, y+20, x+72}, Button { enabled, n }
  86. #define    OButton(y,n)    ButtonW(240, y, n)
  87.  
  88. resource 'DITL' (rBase, "Options", purgeable) {
  89.     {
  90.         OButton(198, "Run"),        // 1
  91.         OButton(168, "Cancel"),        // 2
  92.         OButton(60,  "About…"),        // 3
  93.         {3, 306, 35, 338},        Icon { enabled, rBase },        // 4
  94.         {40, 214, 218, 216},    UserItem { disabled },            // 5
  95.         Option(0, "Enable extensions"),            // 6
  96.         Option(1, "Verbose compile"),            // 7
  97.         Option(2, "Display generated code"),    // 8
  98. //        Option(3, "Buffer stderr"),                // 9
  99.         Option(3, "Buffer output"),                // 9
  100.         Option(4, "Verbose execution"),            // 10
  101.         Option(5, "Trace execution"),            // 11
  102.         Option(7, "Patch interpreter"),            // 12
  103.         Option(8, "Debug MacBob"),                // 13
  104.         {10, 10, 26, 100},        StaticText { disabled, "Options" },
  105.         emptyRect,                HelpItem { enabled, HMScanhdlg { rHelp } },
  106.         emptyRect,                HelpItem { enabled, HMScanhdlg { rHelp+1 } }
  107.     }
  108. };
  109.  
  110. resource 'DKey' (rBase) {        // Key equivalents information
  111.     {
  112.         "R", 1,        cmdKey, anyUp,
  113.         ".", 2,        cmdKey, anyUp,
  114.         "A", 3,        cmdKey, anyUp,
  115.         "?", 4,        cmdKey, anyUp,
  116.  
  117.         "E", 6,        cmdKey, anyUp,
  118.         "V", 7,        cmdKey, anyUp,
  119.         "D", 8,        cmdKey, anyUp,
  120.         "B", 9,        cmdKey, anyUp,
  121.         "X", 10,    cmdKey, anyUp,
  122.         "T", 11,    cmdKey, anyUp,
  123.         "P", 12,    cmdKey, anyUp,
  124.         "Z", 13,    cmdKey, anyUp
  125.     }
  126. };
  127.  
  128.  
  129. resource 'DLOG' (rBase+1, "About…", purgeable) {
  130.     {0, 0, 250, 380},
  131.     dBoxProc, visible, noGoAway,
  132.     0, rBase+1, ""
  133. };
  134.  
  135. #define    left            40
  136. #define    right            340
  137.  
  138. resource 'DITL' (rBase+1, "About…") {
  139.     {
  140.         // 1
  141.         {220, 150, 240, 230},
  142.             Button { enabled, "OK" },
  143.         // 2
  144.         {20, 75, 44, right},
  145. //            StaticText { disabled, "MacBob " versString },
  146.             StaticText { disabled, "MacBob " versString "\n" $$Date " " $$Time },
  147.         // 3
  148.         {60+8, left, 72+8, right},
  149.             StaticText { disabled, "Original Bob code written by David Michael Betz, © 1991." },
  150.         // 4
  151.         {88+4, left, 100+4, right},
  152.             StaticText { disabled, "MacBob code written by Christopher E. Hyde, © 1995." },
  153.         // 5
  154.         {116, left, 210, right},
  155.             StaticText { disabled, "This extension is shareware, as is the source code.  "
  156.                 "Feel free to send money comments or questions to Christopher E. Hyde at:\n"
  157.                 "\n\n\n\nemail: drjekyll@hylight.demon.co.uk." },
  158.         // 6
  159.         {146, left+31, 182, right},
  160.             StaticText { disabled,
  161.                 "25 Carson Road\n"
  162.                 "London  E16 4BD\n"
  163.                 "England (UK)" },
  164.         // 7
  165.         {10, 20, 42, 52},
  166.             Icon { disabled, rBase+10 },
  167.         // 8
  168. //        {52, 20, 53, 360},
  169.         {52, 20, 54, 360},
  170.             UserItem { disabled }
  171.     }
  172. };
  173.  
  174.  
  175. resource 'DLOG' (rBase+2, "Stop Alert") {
  176.     {60, 40, 161, 440},
  177.     dBoxProc, visible, goAway,
  178.     0, rBase+2, ""
  179. };
  180.  
  181. resource 'DITL' (rBase+2, "Stop Alert") {
  182.     {
  183.         {71, 330, 91, 390},        Button { enabled, "OK" },
  184.         {10, 75, 55, 390},        StaticText { disabled, "^0" },
  185.         {10, 20, 42, 52},        Icon { disabled, 0 }
  186.     }
  187. };
  188.  
  189.  
  190. resource 'vers' (1) {
  191.     versNumbers,
  192.     verBritain,
  193.     versString,
  194. //    versString ", © 1995 by Christopher E. Hyde.  All rights reserved."
  195.     versString ", by Christopher E. Hyde\n© 1995.  All rights reserved."
  196. };
  197.  
  198. resource 'vers' (2) {
  199.     versNumbers,
  200.     verBritain,
  201.     versString,
  202.     "A BBEdit Extension"
  203. };
  204.  
  205. resource 'STR ' (-16397, "Double-click String", purgeable) {
  206.     "BBEdit extension\n\n"
  207.         "You cannot open this extension directly, but if you put it in "
  208.         "your ‘BBEdit Extensions’ folder, you will be able to select it "
  209.         "from the ‘Extensions’ menu when running BBEdit or BBEdit Lite."
  210. };
  211.  
  212.  
  213. resource 'STR#' (rBase, "Error Messages") {
  214.     {
  215.         "MacBob can only run if used with BBEdit (or BBEdit Lite) version 2.0 or later.";
  216.         "MacBob cannot run on this kind of window.  Try opening a regular document.";
  217.         "Execution of the MacBob program has been interrupted.";
  218.         "Balloon Help is only available if you are running System 7.0 or later.";
  219.         "MacBob could not get the window contents from BBEdit.  "
  220.             "Try restarting the application.";
  221.         "MacBob could not allocate enough memory. "
  222.             "Try closing some documents or quitting other running applications.";
  223.         "MacBob cannot find the function ‘main’.";
  224.         "Too much recursion during garbage collection.  Out of stack space.";
  225.         "MacBob has encountered an error of unknown origin.  "
  226.             "Please contact a reputable etymologist.";
  227.     }
  228. };
  229.  
  230. resource 'STR#' (rBase+1, "Token Names") {
  231.     {
  232.         "<string>",            "<identifier>",        "<number>",
  233.         "class",            "static",            "if",                "else",
  234.         "while",            "return",            "for",                "break",
  235.         "continue",            "do",                "new",                "nil",
  236.         "<=",                "==",                "!=",                ">=",
  237.         "<<",                ">>",                "&&",                "||",
  238.         "++",                "--",
  239.         "+=",                "-=",                "*=",                "/=",
  240.         "%=",                "&=",                "|=",                "^=",
  241.         "<<=",                ">>=",                "::",                "->"
  242.     }
  243. };
  244.  
  245.  
  246. // ==========================================================================================
  247.  
  248.  
  249. #include <BalloonTypes.r>
  250.  
  251. #define    rHelpStrs        rHelp
  252. #define    noHelpStr        0, 0
  253. #define    zeroPt        {0, 0}
  254. #define    leftEdge        {8, 1}
  255.  
  256. #define    HelpStr(n)            rHelpStrs, n
  257. #define    ButtonHelp(n)        HMStringResItem { zeroPt, emptyRect, HelpStr(n), noHelpStr, noHelpStr, noHelpStr }
  258. #define    CheckBoxHelp(n)    HMStringResItem { leftEdge, emptyRect, HelpStr(n), noHelpStr, HelpStr(n), noHelpStr }
  259.  
  260. resource 'hdlg' (rHelp, "Balloon Help 1", purgeable) {
  261.     HelpMgrVersion, 0,
  262.     hmDefaultOptions, 0, 0,
  263.     HMSkipItem {}, {
  264.         ButtonHelp(1),
  265.         ButtonHelp(2),
  266.         ButtonHelp(3),
  267.         ButtonHelp(4)
  268.     }
  269. };
  270.  
  271. resource 'hdlg' (rHelp+1, "Balloon Help 2", purgeable) {
  272.     HelpMgrVersion, 5,
  273.     hmDefaultOptions, 0, 3,
  274.     HMSkipItem {}, {
  275.         CheckBoxHelp(5),
  276.         CheckBoxHelp(6),
  277.         CheckBoxHelp(7),
  278.         CheckBoxHelp(8),
  279.         CheckBoxHelp(9),
  280.         CheckBoxHelp(10),
  281.         CheckBoxHelp(11),
  282.         CheckBoxHelp(12)
  283.     }
  284. };
  285.  
  286.  
  287. resource 'STR#' (rHelpStrs, "Balloon Help Strings") {
  288.     {
  289.         "Compile and run the program in the front window.  ∞R";
  290.         "Close the dialog box without compiling and running the program.  ∞.";
  291.         "Display information about this version of MacBob.  ∞A";
  292.         "Toggle balloon help on and off.  ∞?";
  293.         "Enable the MacBob extensions to the Bob programming language.  ∞E";
  294.         "Print messages to the output window while compiling.  ∞V";
  295.         "Display in the output window the opcodes for each function compiled.  ∞D";
  296. //        "Buffer output to stderr.  This increases the speed of error printing.  ∞B";
  297.         "Buffer output.  This increases the speed of printing.  ∞B";
  298.         "Print messages to the output window while running the MacBob program.  ∞X";
  299.         "Trace the execution of the MacBob program.  ∞T";
  300.         "Patch the actual machine code of the MacBob interpreter function.  "
  301.             "This can give up to a 3 fold speed increase.  ∞P";
  302.         "Debug the internals of MacBob.  "
  303.             "Only really useful if you have modified the source code.  ∞Z";
  304.     }
  305. };
  306.